import { ResPage, SysSequence } from "@/api/interface/index";
import { CANROCNET } from "@/api/config/servicePort";
import http from "@/api";

/**
 * 新增序列
 *
 * @param params 序列表单
 * @returns 返回是否成功
 */
export const addSequenceApi = (params: SysSequence.Form) => {
  return http.post<boolean>(`${CANROCNET}/api/sys-sequence/addition`, params);
};

/**
 * 编辑序列
 *
 * @param params 序列表单
 * @returns 返回是否成功
 */
export const editSequenceApi = (params: SysSequence.Form) => {
  return http.post<boolean>(`${CANROCNET}/api/sys-sequence/edit`, params);
};

/**
 * 启用/禁用序列
 *
 * @param params 序列Id
 * @returns 返回是否成功
 */
export const switchEnableSequenceApi = (params: { id: string }) => {
  return http.post<boolean>(`${CANROCNET}/api/sys-sequence/enable`, params);
};

/**
 * 删除序列
 *
 * @param params 序列Id
 * @returns 返回是否成功
 */
export const deleteSequenceApi = (params: { ids: string[] }) => {
  return http.post<boolean>(`${CANROCNET}/api/sys-sequence/del`, params);
};

/**
 * 获取序列列表
 *
 * @param params 序列查询参数
 * @returns 返回序列列表
 */
export const getSequencePageApi = (params: SysSequence.PageParams) => {
  return http.get<ResPage<SysSequence.Result>>(`${CANROCNET}/api/sys-sequence/page`, params);
};
